<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../include.jsp" %>

<html>
<head>	
	
	<script type="text/javascript">        
	var $ = jQuery.noConflict();	

	$(document).ready(function() {

    	// 등록
		$("#id_btn_add").click(function(e) {
			e.preventDefault();

			if ($("#id_hid_single_on").val() == "on") {
				location.href = '/board/add/BBS_ID/${objBbsInfo.bbsId}?single=on';
			} else {
				location.href = '/board/add/BBS_ID/${objBbsInfo.bbsId}';
			}
		});
   	
	});
    </script>
    
	<script type="text/javascript"> 
		function fnViewArticle(e, strAticleNo) {
			
			if (e.preventDefault) {
				e.preventDefault();
			} else {
				e.returnValue = false;
			}
			
			if ($("#id_hid_board_page").val() != "") {
				if ($("#id_hid_single_on").val() == "on") {
					location.href = '/board/view/BBS_ID/${objBbsInfo.bbsId}/ATC_NO/' + strAticleNo + '?single=on&page=' + $("#id_hid_board_page").val();
				} else {
					location.href = '/board/view/BBS_ID/${objBbsInfo.bbsId}/ATC_NO/' + strAticleNo + '?page=' + $("#id_hid_board_page").val();
				}
			} else {
				location.href = '/board/view/BBS_ID/${objBbsInfo.bbsId}/ATC_NO/' + strAticleNo;
			}
		}
	</script>
</head>
<body>

	<input type="hidden" id="id_hid_single_on" value="${single}" />
	<input type="hidden" id="id_hid_board_page" value="${page}" />

	<h3>${objBbsInfo.bbsNm}</h3>

	<b>${objBbsInfo.bbsDesc}</b>
	<br><br>
	
	

	<!-- [S] 검색 결과 -->
	<div class="tbl_type1">  
	    <table cellspacing="0" summary="표에 관한 요약 정보">  
	   	<c:if test="${!empty boardCatgList}"><col width="90"></c:if>
	   	<col>  
	   	<col width="40">
    	<col width="80">  
    	<col width="40">  
    	<col width="80">  
    
	    <thead>
		    <tr>   
		    <c:if test="${!empty boardCatgList}"><th>유형</th></c:if>
		    <th><spring:message code="board.col.title"/></th>
		    <th><spring:message code="board.col.attach"/></th>
		    <th><spring:message code="board.col.writer"/></th>
		    <th>HIT</th>
		    <th><spring:message code="board.col.write.date"/></th>
		    </tr>
	    </thead>  
	
		<c:if test="${!empty objArticleList}">
	    <tbody>  
	    	<div id="id_div_result">
	    	<c:forEach items="${objArticleList}" var="objArticle" varStatus="i">
		    <tr> 
		    	<c:if test="${!empty boardCatgList}"> 
		    	<!-- 유형 -->	
		    	<td>
		    		${objArticle.subCdCatId}
		    	</td>
		    	</c:if>	
		    			    
				<!-- 제목 -->				   
			    <td style="text-align:left;">
			    	<c:if test="${objArticle.bbsDepth != 0}">
			    		<c:forEach var="depth" begin="1" end="${objArticle.bbsDepth}" >&nbsp;&nbsp;</c:forEach>
			    		<img src="/img/ico_re.gif">
			    	</c:if>
			    	
					<c:choose> 
				    	<c:when test="${!empty objViewArticle}">
				    		<c:if test="${objViewArticle.atcNo == objArticle.atcNo}"><b></c:if>
							<a href="#" onClick="fnViewArticle(event, '${objArticle.atcNo}')" class="none_color">${objArticle.ttl}</a>
				    		<c:if test="${objViewArticle.atcNo == objArticle.atcNo}"></b></c:if>
				    	</c:when>
				    	<c:otherwise>
							<a href="#" onClick="fnViewArticle(event, '${objArticle.atcNo}')" class="none_color">${objArticle.ttl}</a>
				    	</c:otherwise>
				    </c:choose>
				    			    	
			    	<c:if test="${!empty objArticle.articleCommentList}">
						<font color="#A7A7A7">[<c:out value="${fn:length(objArticle.articleCommentList)}"/>]</font>
					</c:if>
			    </td>
			    				    
			    <!-- 첨부 -->
			    <td>
			    	<c:if test="${!empty objArticle.articleFileList}">
			    		<img src="/img/btn_down01.gif">
			    	</c:if>
			    </td>

			    <!-- 작성자 -->
			    <td>
			    	<html:emp empNo="${objArticle.regrEmpNo}" type="empNm" />
			    	<input type="hidden" id="id_reqrEmpNo_${i.count}" value="${objArticle.regrEmpNo}" />
			    </td>  
			    
			    <!-- HIT -->
			    <td>${objArticle.readCnt}</td>
			    
			    <!-- 작성일 -->
			    <td><fmt:formatDate value="${objArticle.regYmdt}" pattern="yyyy-MM-dd" /></td>  
		    </tr>  		
	    	</c:forEach>
	     	</div>	 
	    </tbody>  
	    </c:if>
	
	    </table>  
	</div> 
	<!-- [E] 검색 결과 -->



	<!-- [S] 페이징 결과 -->
	<div style="text-align:center">
		${pageHTML}
	</div>
	<!-- [E] 페이징 결과 -->

	
	


		
	<br><br> 
	
	<c:if test="${boardRoleWrite == 'OK'}">
	<div style="text-align:center;">
		<a href="#" id="id_btn_add" class="btn_big"><strong><spring:message code="button.registor"/></strong></a>
	</div>
	</c:if>				    



	
</body>
</html>